import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: "/a"
  },
  {
    path: '/a',
    name: '/a',
    component: () => import('@/views/a.vue')
  },
  {
    path: '/b',
    name: '/b',
    component: () => import('@/views/b.vue')
  },
  {
    path: "/:catchAll(.*)",
    name: '404',
    component: () => import('@/views/defaultPage/404.vue')
  }
]

// hash路由
const HASH: boolean = true;
const router = createRouter({
  history: HASH ? createWebHashHistory() : createWebHistory(),
  routes
})

export default router